package org.example.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class Person {
    private String name;

    // 如果显示标注了required为false，则这个属性可以为空
    @Autowired(required = false)
    private Cat cat;

    @Autowired
    @Qualifier("dog")  // 指定名称，用于处理变量名与属性名不一致的情况
    private Dog dog;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Cat getCat() {
        return cat;
    }

    public void setCat(Cat cat) {
        this.cat = cat;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }
}
